package com.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.entity.Statistics;
import com.repository.StatisticsDao;

@Service("StatisticsService")
public class StatisticsServiceImpl implements StatisticsService{

	@Autowired
	private StatisticsDao statisticsDao;
	
	@Override
	@Transactional
	public Statistics statistics() {
		Statistics s = countSuccess();
		s.setProduct(countProduct());
		s.setCompany(countUser("000002"));
		s.setInvestor(countUser("000001"));
		return s;
	}
	
	@Override
	public int countProduct() {
		return statisticsDao.countProduct();
	}

	@Override
	public Statistics countSuccess() {
		return statisticsDao.countSuccess();
	}

	@Override
	public int countUser(String userTypeId) {
		return statisticsDao.countUser(userTypeId);
	}

}
